﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Configuration;

namespace QSTOOL.Codes
{
    public class Result
    {
        public const string START = "#START#";
        public const string END = "#END#";
        public const string COMMAND_TYPE = "#COMMAND-TYPE#";
        public int ReturnCode { get; private set; }
        public string ReturnMsg { get; private set; }
        public string LogFile { get; private set; }
        public string CommandType { get; private set; }
        //private Hashtable ErrInfo{ get; set; }

        public Result(string rtnString, string cmdType)
        {
            if (!String.IsNullOrEmpty(rtnString))
            {
                string[] aryResult = rtnString.Split(';');
                this.ReturnCode = Convert.ToInt32(aryResult[0]);
                this.ReturnMsg = aryResult[1];
                this.LogFile = aryResult[2];
                this.CommandType = cmdType;
            }
        }

        private void Init()
        {
            //this.ErrInfo = new Hashtable();
            //this.ErrInfo.Add(Command.DB2 + "_0", "执行成功!");
        }

        public string GetMessage()
        {
            return ConfigurationManager.AppSettings[this.CommandType+"|"+this.ReturnCode.ToString()].ToString();
        }

    }
}
